<?php
namespace Tiger\Api\Providers;

use Illuminate\Support\ServiceProvider;
use Illuminate\Foundation\AliasLoader;
use Dingo\Api\Contract\Http\Validator;

class TigerApiServerProvider extends ServiceProvider
{


    /**
     * @var array 命令行
     */
    protected $commands = [
        'Tiger\Api\Commands\MakeApiRouteCommand',
        'Tiger\Api\Commands\MakeApiAuthRouteCommand',
        'Tiger\Api\Commands\MakeApiAuthControllerCommand',


        'Tiger\Api\Commands\MakeApiTransformerCommand',
        'Tiger\Api\Commands\MakeApiModelCommand',
        'Tiger\Api\Commands\MakeApiControllerCommand',
    ];

    /**
     * The application's route middleware.
     *
     * @var array
     */
    protected $routeMiddleware = [
    ];


    /**
     * The application's route middleware groups.
     *
     * @var array
     */
    protected $middlewareGroups = [
    ];
    /**
     * Boot the service provider.
     *
     * @return void
     */
    public function boot()
    {
        //发布配置文件
        $this->publishes([__DIR__ . '/../../config/tiger-api.php' => config_path('tiger-api.php')], 'tiger-api');
        //发布特殊文件
        $this->publishes([__DIR__ . '/../../src/Commands/stubs/Profile.stub' => app_path('Models/Profile.php')], 'tiger-api');
        $this->publishes([__DIR__ . '/../../src/Commands/stubs/ProfileTransformer.stub' => app_path('Transformers/ProfileTransformer.php')], 'tiger-api');
        $this->publishes([__DIR__ . '/../../routes/sms_routes.php' => app_path('Api/V1/Controllers/SMS/routes.php')], 'tiger-api');
        $this->publishes([__DIR__ . '/../../src/Commands/stubs/SmsController.stub' => app_path('Api/V1/Controllers/SMS/SmsController.php')], 'tiger-api');
        //发布路由文件
        $this->publishes([__DIR__ . '/../../routes/routes.php' => app_path('Api/V1/Controllers/routes.php')], 'tiger-api');

        $this->publishes([__DIR__ . '/../../migrations/2014_10_12_000000_create_profile_table.back' => database_path('migrations').'/2014_10_12_000000_create_profile_table.php']);
        //包含路由
        if (file_exists($routes = base_path('app/Api/V1/Controllers/routes.php'))) {
            require base_path('app/Api/V1/Controllers/routes.php');
        }





    }


    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        //注册命令行文件
        $this->commands($this->commands);

    }



    /**
     * Setup auth configuration.
     *
     * @return void
     */
    protected function setupAuth()
    {

    }


}